{extend name="base/index"/}

{block name="page_location"}
<!-- END PAGE TITLE & BREADCRUMB-->
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>商品列表</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有商品
				<a href="{:url('goods/publish')}" class="btn btn-success btn-sm ml-3">发布新产品</a>
			</h4>
		</div>
	</div>
</div>
{/block}
{block name="body"}
<div class="row" id="goods_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<form class="form-inline" style="margin-bottom:10px;">
					<div class="input-group">
						<div class="input-group-prepend">
							<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
							 aria-expanded="false">选择</button>
							<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="all" attr-bind="check_id">全选</a>
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="reverse" attr-bind="check_id">反选</a>
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="cancel" attr-bind="check_id">取消</a>
							</div>
						</div>
						<div class="input-group-prepend">
							<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
							 aria-expanded="false">操作选中的</button>
							<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-model="goods" attr-type="enable" attr-class=".check_id">上架</a>
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-model="goods" attr-type="disable" attr-class=".check_id">下架</a>
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-model="goods" attr-type="del" attr-class=".check_id">删除</a>
							</div>
						</div>
						<a href="javascript:;" class="btn btn-primary" id="Fast_Sort" attr-model="goods" attr-frm="goods_list_frm">更新排序</a>
						<a href="javascript:;" class="btn btn-primary" id="show_goodsflag_btn" data-toggle="modal" data-target="#goods_flag_box" >产品标志管理</a>
						<input type="text" name="kw" class="form-control kw enter_goto" placeholder="" aria-label="" aria-describedby="basic-addon1">
						<div class="input-group-append">
							<button class="btn btn-dark search_btn" type="button" attr-ipt="kw" attr-url="{:url('goods/index')}">搜索</button>
						</div>						
					</div>
				</form>
				<form action="" method="post" id="goods_list_frm">
					<table class="table table-hover">
						<thead>
							<tr>
								<th>选择</th>
								<th>编号</th>
								<th>图片</th>
								<th>分类</th>
								<th>名称</th>
								<th>重量</th>
								<th>销售价格</th>
								<th>库存/剩余</th>
								<th>排序</th>
								<th>更新时间</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{volist name='list' id="data"}
							<tr>
								<td>
									<div class="custom-control custom-checkbox">
										<input type="checkbox" class="custom-control-input check_id" id="check_id{$data.id}" value="{$data.id}" name="check_id[]">
										<label class="custom-control-label" for="check_id{$data.id}">ID:{$data.id}</label>
									</div>
								</td>
								<td>{$data.gid}</td>
								<td><a href="javascript:;" target="_blank"><img class="list_facepic preview_img" src="{$data.picurl|default='/static/admin/images/nopic.png'}" /></a></td>
								<td>{$data.classname}</td>
								<td><a href="javascript:;" target="_blank" title="{$data.goodsname}">{$data.goodsname|ReStrLen=10,'...'}</a></td>
								<td>{$data.weight} kg</td>
								<td>{$data.salesprice}</td>
								<td><span class="badge badge-primary">{$data.housenum}/{$data.housenum-$data.salesvolume}</span></td>
								<td>
									<input type="hidden" name="field_ids[]" value="{$data.id}" />
									<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$data.orderid}">                              	
								</td>
								<td title="{$data.posttime|date="Y-m-d H:i:s",###}"><span class="badge badge-primary">{$data.posttime|date="Y-m-d H:i",###}</span></td>
								<td>
									{eq name="data.status" value="0"}
									<a href="javascript:;" attr-model="goods" attr-field="status" attr-val="1" attr-id="{$data.id}" class="badge badge-primary Fast_Action">上架</a>
									{else /}
									<a href="javascript:;" attr-model="goods" attr-field="status" attr-val="0" attr-id="{$data.id}" class="badge badge-secondary Fast_Action">下架</a>
									{/eq}
								</td>
								<td class="table-action">
									<div class="btn-group mb-2">
										<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">操作</button>
										<div class="dropdown-menu">
											<a class="dropdown-item" href="{:url('goods/publish')}?act=edit&id={$data.id}">修改信息</a>
											<!-- <a class="dropdown-item" href="javascript:;">相关订单</a>
											<a class="dropdown-item" href="javascript:;">相关评价</a> -->
											<div class="dropdown-divider"></div>
											<a class="dropdown-item Fast_Del" href="javascript:;" attr-id="{$data.id}" attr-model="goods">删除</a>
										</div>
									</div>
								</td>
							</tr>
							{/volist}
						</tbody>
					</table>
                </form>
				<div class="row">
					<div class="col-12" style="text-align: center;">
						{$pagelist}
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="modal_dig"}
<!-- Modal -->
<div class="modal fade" id="goods_flag_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-full-700">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title" id="myModalLabel">产品标志管理</h4>
		<button type="button" class="close" data-dismiss="modal">x</button>
      </div>
      <div class="modal-body">
		<div class="card">
			<div class="card-body">
				<ul class="nav nav-tabs nav-justified nav-bordered mb-3">
					<li class="nav-item">
						<a href="#tab_1_1" data-toggle="tab" aria-expanded="false" class="nav-link active">
							<i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
							<span class="d-lg-block">所有标志</span>
						</a>
					</li>
					<li class="nav-item">
						<a href="#tab_1_2" data-toggle="tab" aria-expanded="true" class="nav-link ">
							<i class="mdi mdi-account-circle d-lg-none d-block mr-1"></i>
							<span class="d-lg-block">创建新标志</span>
						</a>
					</li>
				</ul>

				<div class="tab-content">
					<div class="tab-pane show active" id="tab_1_1">
						 <form action="#" class="form-horizontal" id="goods_flag_list_frm">
							<table class="table table-hover">
								<thead>
									<tr>
										<th>编号</th>
										<th>标志</th>
										<th>标志名称</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
								</tbody>
							</table>
							<div class="pagination pagination-small txtcenter"></div>			
						 </form>
					</div>
					<div class="tab-pane " id="tab_1_2">
						<form action="#" class="form-horizontal" method="post" id="goods_flag_frm">
							<div class="form-group row mb-1">
								<label class="col-3 col-form-label">标志：</label>
								<div class="col-5">
									<input type="text" class="form-control ipt_check" name="flag" data-type="enname" placeholder="输入1位的字母或数字的标志" data-len="1-1" nullmsg="标志不能为空" errormsg="标志只能由1位的字母、数字组成"/>
								</div>
							</div>
							<div class="form-group row mb-1">
								<label class="col-3 col-form-label">标志名称：</label>
								<div class="col-5">
									<input type="text" class="form-control ipt_check" name="flagname" data-type="string" data-len="1-10" nullmsg="标志名称不能为空" errormsg="标志只能由1-10位的字符组成"/>
									<span class="font-13 text-muted">可以用中文名称</span>
								</div>
							</div>
							<div class="form-group row mb-1">
								<label class="col-3 col-form-label"></label>
								<div class="col-5">
									<button type="submit" class="btn btn-primary" id="add_goodsflag_btn"><i class="icon-ok"></i> 提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div> <!-- end card-body-->
		</div>
      </div>
    </div>
  </div>
</div>
{/block}